"""
用例基类
"""
import unittest
from time import sleep
from framwork.common.tools import open_browsers
from framwork.pages.login_page import LoginPage


class BaseCase(unittest.TestCase):
    def setUp(self) -> None:
        self.driver = open_browsers()
        self.login_page = LoginPage(self.driver)

    def tearDown(self) -> None:
        sleep(1)
        self.driver.quit()

    def login(self, username='admin', password='123456'):
        """通用的登录方法"""
        self.login_page.open()
        self.login_page.input_username(username)
        self.login_page.input_password(password)
        self.login_page.click_btn()
        sleep(2)  # 等待登录完成
        return True
